{% extends 'index/base.html' %}
{% from 'pagination.html' import render_front_pager %}

{% block title %}{{ crawler.name }}{% endblock %}

{% block content %}
  <section class="mt-4">
    <div class="row">
      <div class="col-md-8 mb-4">
        <div class="card mb-4 wow fadeIn">
          <img src="{{ url_for('poly.get_cover', filename=crawler.image) }}" class="img-fluid" alt="" height="320" width="730">
        </div>
        <div class="card mb-4 wow fadeIn">
          <div class="card-body">
            <p class="h5 my-4">{{ crawler.name }}</p>
            {% for item in records %}
            <p><a style="color:#000" href="{{ item.url }}" target="_blank">{{ item.title }}</a></p>
            {% endfor %}
          </div>
        </div>
        {{ render_front_pager(pagination=pagination, crawler_id=crawler.id) }}
      </div>



      <div class="col-md-4 mb-4">
          <div class="card mb-4 wow fadeIn">
            <div class="card-header">喜欢这个订阅吗？</div>
              <div class="card-body">
                <div class="text-center">
                    {% if current_user.is_subscribing(crawler) %}
                    <form method="post" action="{{ url_for('user.sub_delete', crawler_id=crawler.id) }}">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
                        <button class="btn btn-info btn-md waves-effect waves-light" type="submit">取消订阅</button>
                    </form>
                    {% else %}
                        <a class="btn btn-info btn-md waves-effect waves-light" href="{{ url_for('user.sub_add', crawler_id=crawler.id) }}">立即订阅</a>
                    {% endif %}
                </div>
            </div>
          </div>

        <div class="card mb-4 wow fadeIn">

          <div class="card-header">猜你喜欢</div>
            <div class="card-body">
              <ul class="list-unstyled">
                {% for each in likely %}
                <li class="media">
                  <div class="media-body">
                    <a href="{{ url_for('poly.detail', crawler_id=each.id) }}">
                      <h5 class="mt-0 mb-1 font-weight-bold">{{ each.name }}</h5>
                    </a>
                  </div>
                </li>
                {% endfor %}
              </ul>
            </div>
          </div>
      </div>
    </div>
  </section>
{% endblock %}